#include <iostream>
#include <functional>
#include <set>

/*仿函数*/
class Func
{
public:
    Func(int n) : n(n) {}
    bool operator()(int num)
    {
        return num > 2 && num % n == 0;
    }

private:
    int n;
};

bool IsGtreaterThan(int num, int n)
{
    return num > 3 && num % n == 0;
}

int count(int *nums, int numsSize, Func f)
{
    int count = 0;
    for (int idx = 0; idx < numsSize; idx++)
    {
        if (f(nums[idx]) == true)
        {
            count++;
        }
    }
    return count;
}

int main()
{
#if 1
    Func f(2);
    int arr[] = {1, 2, 3, 4, 5, 6};
    int res = count(arr, sizeof(arr) / sizeof(arr[0]), f);
    std::cout << res << std::endl;
#endif
#if 0
    std::set<int, std::less<int>> s;
    s.insert(1);
    s.insert(2);
    s.insert(3);
    for (int num : s)
    {
        std::cout << num << "\t";
    }
    std::cout << std::endl;
    return 0;
#endif
}